﻿
@section scripts {
    <script src="~/Scripts/metadata.js"></script>
    <script src="~/Scripts/manager.js"></script>
    <script type="text/javascript">
    var viewModel = {
        entityList: ko.observableArray()
    };

    var serviceName = '/breeze/@ViewBag.Service';
    var manager = new createEntityManager(serviceName);

    $(function () {
        manager.fetchEntityByKey("@ViewBag.Type", "@ViewBag.Id").then(function (result) {
            viewModel.entity = result.entity;
            var entityKey = result.entityKey;
            var fromCache = result.fromCache;
            ko.applyBindings(viewModel);
        }).fail(function (error) { alert(error); });
    });

    </script>
}


@{
    string type = ViewBag.Type;
}
@Html.Partial("Entity/" + type)
